IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[cms_sp_WorkflowSelectOne]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[cms_sp_WorkflowSelectOne]
GO
create procedure [dbo].[cms_sp_WorkflowSelectOne]
@WorkflowId uniqueidentifier
as
select 
	WorkflowId,
	Cycle,
	ApproveDateDeadline,
	ReviewDateDeadline,
	CreatedBy,
	DateCreated,
	LastUpdatedBy,
	DateLastUpdated
from dbo.Workflows
where WorkflowId = @WorkflowId
select 
	WorkflowHistoryId,
	WorkflowId,
	UserGroupId,
	UserId,
	WorkflowState,
	WorkflowData,
	WorkflowDataType,
	IsLatestState,
	Notes,
	CreatedBy,
	DateCreated,
	LastUpdatedBy,
	DateLastUpdated
from dbo.WorkflowHistory
where WorkflowId = @WorkflowId


GO

